<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>s3.connection</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="s3-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="s3-module.html">Package&nbsp;s3</a> ::
        Module&nbsp;connection
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="s3.connection-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="s3.connection-module.html">Module s3.connection</a></h1>
<pre class="py-src">
<tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">base64</tt> </tt>
<tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">hmac</tt> </tt>
<tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">httplib</tt> </tt>
<tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sha</tt> </tt>
<tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">socket</tt> </tt>
<tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">urllib</tt> </tt>
<tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">time</tt> <tt class="py-keyword">import</tt> <tt class="py-name">gmtime</tt><tt class="py-op">,</tt> <tt class="py-name">strftime</tt> </tt>
<tt class="py-lineno">  8</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Package s3=s3-module.html"><a title="s3" class="py-name" href="#" onclick="return doclink('link-0', 's3', 'link-0');">s3</a></tt></tt> </tt>
<tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name"><a title="s3" class="py-name" href="#" onclick="return doclink('link-1', 's3', 'link-0');">s3</a></tt></tt><tt class="py-op">.</tt><tt id="link-2" class="py-name" targets="Module s3.parsers=s3.parsers-module.html"><a title="s3.parsers" class="py-name" href="#" onclick="return doclink('link-2', 'parsers', 'link-2');">parsers</a></tt></tt> <tt class="py-keyword">import</tt> <tt id="link-3" class="py-name" targets="Function s3.parsers.parseError()=s3.parsers-module.html#parseError"><a title="s3.parsers.parseError" class="py-name" href="#" onclick="return doclink('link-3', 'parseError', 'link-3');">parseError</a></tt></tt> </tt>
<tt class="py-lineno"> 11</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt id="link-4" class="py-name" targets="Variable s3.connection.PORTS_BY_SECURITY=s3.connection-module.html#PORTS_BY_SECURITY,Variable s3.generator.PORTS_BY_SECURITY=s3.generator-module.html#PORTS_BY_SECURITY"><a title="s3.connection.PORTS_BY_SECURITY
s3.generator.PORTS_BY_SECURITY" class="py-name" href="#" onclick="return doclink('link-4', 'PORTS_BY_SECURITY', 'link-4');">PORTS_BY_SECURITY</a></tt></tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> <tt class="py-number">443</tt><tt class="py-op">,</tt> <tt class="py-name">False</tt><tt class="py-op">:</tt> <tt class="py-number">80</tt> <tt class="py-op">}</tt> </tt>
<tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
<a name="S3Connection"></a><div id="S3Connection-def"><tt class="py-lineno"> 14</tt> <a class="py-toggle" href="#" id="S3Connection-toggle" onclick="return toggle('S3Connection');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html">S3Connection</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="S3Connection-expanded"><a name="S3Connection.__init__"></a><div id="S3Connection.__init__-def"><tt class="py-lineno"> 15</tt> <a class="py-toggle" href="#" id="S3Connection.__init__-toggle" onclick="return toggle('S3Connection.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">pub_key</tt><tt class="py-op">,</tt> <tt class="py-param">priv_key</tt><tt class="py-op">,</tt> <tt class="py-param">secure</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-param">host</tt><tt class="py-op">=</tt><tt id="link-5" class="py-name"><a title="s3" class="py-name" href="#" onclick="return doclink('link-5', 's3', 'link-0');">s3</a></tt></tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Variable s3.DEFAULT_HOST=s3-module.html#DEFAULT_HOST"><a title="s3.DEFAULT_HOST" class="py-name" href="#" onclick="return doclink('link-6', 'DEFAULT_HOST', 'link-6');">DEFAULT_HOST</a></tt></tt><tt class="py-op">,</tt> <tt class="py-param">port</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">debug</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection.__init__-expanded"><tt class="py-lineno"> 16</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pub_key</tt> <tt class="py-op">=</tt> <tt class="py-name">pub_key</tt> </tt>
<tt class="py-lineno"> 17</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_priv_key</tt> <tt class="py-op">=</tt> <tt class="py-name">priv_key</tt> </tt>
<tt class="py-lineno"> 18</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_host</tt> <tt class="py-op">=</tt> <tt class="py-name">host</tt> </tt>
<tt class="py-lineno"> 19</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">port</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 20</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt> <tt class="py-op">=</tt> <tt id="link-7" class="py-name"><a title="s3.connection.PORTS_BY_SECURITY
s3.generator.PORTS_BY_SECURITY" class="py-name" href="#" onclick="return doclink('link-7', 'PORTS_BY_SECURITY', 'link-4');">PORTS_BY_SECURITY</a></tt></tt><tt class="py-op">[</tt><tt class="py-name">secure</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 21</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 22</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt> <tt class="py-op">=</tt> <tt class="py-name">port</tt> </tt>
<tt class="py-lineno"> 23</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_secure</tt> <tt class="py-op">=</tt> <tt class="py-name">secure</tt> </tt>
<tt class="py-lineno"> 24</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 25</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">secure</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 26</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt> <tt class="py-op">=</tt> <tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">HTTPSConnection</tt><tt class="py-op">(</tt><tt class="py-string">"%s:%d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_host</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 27</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 28</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt> <tt class="py-op">=</tt> <tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">HTTPConnection</tt><tt class="py-op">(</tt><tt class="py-string">"%s:%d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_host</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 29</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-8" class="py-name" targets="Method s3.connection.S3Connection._set_debug()=s3.connection.S3Connection-class.html#_set_debug"><a title="s3.connection.S3Connection._set_debug" class="py-name" href="#" onclick="return doclink('link-8', '_set_debug', 'link-8');">_set_debug</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">debug</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 30</tt>  <tt class="py-line"> </tt>
<a name="S3Connection._set_debug"></a><div id="S3Connection._set_debug-def"><tt class="py-lineno"> 31</tt> <a class="py-toggle" href="#" id="S3Connection._set_debug-toggle" onclick="return toggle('S3Connection._set_debug');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#_set_debug">_set_debug</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">debug</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection._set_debug-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection._set_debug-expanded"><tt class="py-lineno"> 32</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_debug</tt> <tt class="py-op">=</tt> <tt class="py-name">debug</tt> </tt>
<tt class="py-lineno"> 33</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">set_debuglevel</tt><tt class="py-op">(</tt><tt class="py-name">debug</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 34</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 35</tt>  <tt class="py-line"> </tt>
<a name="S3Connection.clone"></a><div id="S3Connection.clone-def"><tt class="py-lineno"> 36</tt> <a class="py-toggle" href="#" id="S3Connection.clone-toggle" onclick="return toggle('S3Connection.clone');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#clone">clone</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection.clone-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection.clone-expanded"><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-docstring">"""C.clone() -&gt; new connection to s3"""</tt> </tt>
<tt class="py-lineno"> 38</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-9" class="py-name" targets="Class s3.connection.S3Connection=s3.connection.S3Connection-class.html"><a title="s3.connection.S3Connection" class="py-name" href="#" onclick="return doclink('link-9', 'S3Connection', 'link-9');">S3Connection</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pub_key</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_priv_key</tt><tt class="py-op">,</tt> <tt class="py-name">secure</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_secure</tt><tt class="py-op">,</tt> <tt class="py-name">host</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_host</tt><tt class="py-op">,</tt> <tt class="py-name">port</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_port</tt><tt class="py-op">,</tt> <tt class="py-name">debug</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_debug</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 39</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 40</tt>  <tt class="py-line"> </tt>
<a name="S3Connection._auth_header_value"></a><div id="S3Connection._auth_header_value-def"><tt class="py-lineno"> 41</tt> <a class="py-toggle" href="#" id="S3Connection._auth_header_value-toggle" onclick="return toggle('S3Connection._auth_header_value');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#_auth_header_value">_auth_header_value</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">method</tt><tt class="py-op">,</tt> <tt class="py-param">path</tt><tt class="py-op">,</tt> <tt class="py-param">headers</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection._auth_header_value-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection._auth_header_value-expanded"><tt class="py-lineno"> 42</tt>  <tt class="py-line">        <tt class="py-name">xamzs</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">k</tt> <tt class="py-keyword">for</tt> <tt class="py-name">k</tt> <tt class="py-keyword">in</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-10" class="py-name" targets="Method s3.objects.S3Bucket.keys()=s3.objects.S3Bucket-class.html#keys,Method s3.service.S3Service.keys()=s3.service.S3Service-class.html#keys"><a title="s3.objects.S3Bucket.keys
s3.service.S3Service.keys" class="py-name" href="#" onclick="return doclink('link-10', 'keys', 'link-10');">keys</a></tt></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-keyword">if</tt> <tt class="py-name">k</tt><tt class="py-op">.</tt><tt class="py-name">startswith</tt><tt class="py-op">(</tt><tt class="py-string">"x-amz-"</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 43</tt>  <tt class="py-line">        <tt class="py-name">xamzs</tt><tt class="py-op">.</tt><tt class="py-name">sort</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-name">auth_parts</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">method</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 45</tt>  <tt class="py-line">                      <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name" targets="Method s3.generator.S3Generator.get()=s3.generator.S3Generator-class.html#get,Method s3.objects.S3Bucket.get()=s3.objects.S3Bucket-class.html#get,Method s3.service.S3Service.get()=s3.service.S3Service-class.html#get"><a title="s3.generator.S3Generator.get
s3.objects.S3Bucket.get
s3.service.S3Service.get" class="py-name" href="#" onclick="return doclink('link-11', 'get', 'link-11');">get</a></tt></tt><tt class="py-op">(</tt><tt class="py-string">"Content-MD5"</tt><tt class="py-op">,</tt> <tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 46</tt>  <tt class="py-line">                      <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="s3.generator.S3Generator.get
s3.objects.S3Bucket.get
s3.service.S3Service.get" class="py-name" href="#" onclick="return doclink('link-12', 'get', 'link-11');">get</a></tt></tt><tt class="py-op">(</tt><tt class="py-string">"Content-Type"</tt><tt class="py-op">,</tt> <tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 47</tt>  <tt class="py-line">                      <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="s3.generator.S3Generator.get
s3.objects.S3Bucket.get
s3.service.S3Service.get" class="py-name" href="#" onclick="return doclink('link-13', 'get', 'link-11');">get</a></tt></tt><tt class="py-op">(</tt><tt class="py-string">"Date"</tt><tt class="py-op">,</tt> <tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 48</tt>  <tt class="py-line">        <tt class="py-name">auth_parts</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-name">k</tt> <tt class="py-op">+</tt> <tt class="py-string">":"</tt> <tt class="py-op">+</tt> <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">k</tt> <tt class="py-keyword">in</tt> <tt class="py-name">xamzs</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 49</tt>  <tt class="py-line">        <tt class="py-comment"># hmmm fali mi ona perverzija za ?acl i ?torrent</tt> </tt>
<tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">auth_parts</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 51</tt>  <tt class="py-line">        <tt class="py-name">auth_str</tt> <tt class="py-op">=</tt> <tt class="py-string">"\n"</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">auth_parts</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 52</tt>  <tt class="py-line">        <tt class="py-name">auth_str</tt> <tt class="py-op">=</tt> <tt class="py-name">base64</tt><tt class="py-op">.</tt><tt class="py-name">encodestring</tt><tt class="py-op">(</tt> </tt>
<tt class="py-lineno"> 53</tt>  <tt class="py-line">            <tt class="py-name">hmac</tt><tt class="py-op">.</tt><tt class="py-name">new</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_priv_key</tt><tt class="py-op">,</tt> <tt class="py-name">auth_str</tt><tt class="py-op">,</tt> <tt class="py-name">sha</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">digest</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 54</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-string">"AWS %s:%s"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_pub_key</tt><tt class="py-op">,</tt> <tt class="py-name">auth_str</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 55</tt>  <tt class="py-line"> </tt>
<a name="S3Connection._headers"></a><div id="S3Connection._headers-def"><tt class="py-lineno"> 56</tt> <a class="py-toggle" href="#" id="S3Connection._headers-toggle" onclick="return toggle('S3Connection._headers');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#_headers">_headers</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">method</tt><tt class="py-op">,</tt> <tt class="py-param">path</tt><tt class="py-op">,</tt> <tt class="py-param">length</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">headers</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection._headers-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection._headers-expanded"><tt class="py-lineno"> 57</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">headers</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 58</tt>  <tt class="py-line">            <tt class="py-name">headers</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">"Date"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">strftime</tt><tt class="py-op">(</tt><tt class="py-string">"%a, %d %b %Y %H:%M:%S GMT"</tt><tt class="py-op">,</tt> <tt class="py-name">gmtime</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 60</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">length</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 61</tt>  <tt class="py-line">            <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">"Content-Length"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">length</tt> </tt>
<tt class="py-lineno"> 62</tt>  <tt class="py-line">        <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">"Authorization"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name" targets="Method s3.connection.S3Connection._auth_header_value()=s3.connection.S3Connection-class.html#_auth_header_value,Method s3.generator.S3Generator._auth_header_value()=s3.generator.S3Generator-class.html#_auth_header_value"><a title="s3.connection.S3Connection._auth_header_value
s3.generator.S3Generator._auth_header_value" class="py-name" href="#" onclick="return doclink('link-14', '_auth_header_value', 'link-14');">_auth_header_value</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">method</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-name">headers</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 63</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">headers</tt> </tt>
</div><tt class="py-lineno"> 64</tt>  <tt class="py-line"> </tt>
<a name="S3Connection._params"></a><div id="S3Connection._params-def"><tt class="py-lineno"> 65</tt> <a class="py-toggle" href="#" id="S3Connection._params-toggle" onclick="return toggle('S3Connection._params');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#_params">_params</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">params</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection._params-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection._params-expanded"><tt class="py-lineno"> 66</tt>  <tt class="py-line">        <tt class="py-name">p</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<tt class="py-lineno"> 67</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">params</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 68</tt>  <tt class="py-line">            <tt class="py-name">p</tt> <tt class="py-op">=</tt> <tt class="py-string">'?'</tt> <tt class="py-op">+</tt> <tt class="py-name">urllib</tt><tt class="py-op">.</tt><tt class="py-name">urlencode</tt><tt class="py-op">(</tt><tt class="py-name">params</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">p</tt> </tt>
</div><tt class="py-lineno"> 70</tt>  <tt class="py-line"> </tt>
<a name="S3Connection._path"></a><div id="S3Connection._path-def"><tt class="py-lineno"> 71</tt> <a class="py-toggle" href="#" id="S3Connection._path-toggle" onclick="return toggle('S3Connection._path');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#_path">_path</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">bucket</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">obj</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection._path-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection._path-expanded"><tt class="py-lineno"> 72</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">bucket</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 73</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-string">"/"</tt> </tt>
<tt class="py-lineno"> 74</tt>  <tt class="py-line">        <tt class="py-name">bucket</tt> <tt class="py-op">=</tt> <tt class="py-string">"/"</tt> <tt class="py-op">+</tt> <tt class="py-name">bucket</tt> </tt>
<tt class="py-lineno"> 75</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">obj</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 76</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">bucket</tt> </tt>
<tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">bucket</tt> <tt class="py-op">+</tt> <tt class="py-string">"/"</tt> <tt class="py-op">+</tt> <tt class="py-name">urllib</tt><tt class="py-op">.</tt><tt class="py-name">quote</tt><tt class="py-op">(</tt><tt class="py-name">obj</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 78</tt>  <tt class="py-line"> </tt>
<a name="S3Connection._io_len"></a><div id="S3Connection._io_len-def"><tt class="py-lineno"> 79</tt> <a class="py-toggle" href="#" id="S3Connection._io_len-toggle" onclick="return toggle('S3Connection._io_len');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#_io_len">_io_len</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">io</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection._io_len-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection._io_len-expanded"><tt class="py-lineno"> 80</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">io</tt><tt class="py-op">,</tt> <tt class="py-string">"len"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 81</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">len</tt> </tt>
<tt class="py-lineno"> 82</tt>  <tt class="py-line">        <tt class="py-name">o_pos</tt> <tt class="py-op">=</tt> <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">tell</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 83</tt>  <tt class="py-line">        <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">tell</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">-</tt> <tt class="py-name">o_pos</tt> </tt>
<tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt class="py-name">io</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-name">o_pos</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">length</tt> </tt>
</div><tt class="py-lineno"> 87</tt>  <tt class="py-line"> </tt>
<a name="S3Connection.__getattr__"></a><div id="S3Connection.__getattr__-def"><tt class="py-lineno"> 88</tt> <a class="py-toggle" href="#" id="S3Connection.__getattr__-toggle" onclick="return toggle('S3Connection.__getattr__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="s3.connection.S3Connection-class.html#__getattr__">__getattr__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">attr</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="S3Connection.__getattr__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="S3Connection.__getattr__-expanded"><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-name">method</tt> <tt class="py-op">=</tt> <tt class="py-name">attr</tt><tt class="py-op">.</tt><tt class="py-name">upper</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 90</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">f</tt><tt class="py-op">(</tt><tt class="py-param">bucket</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">obj</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">send_io</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">params</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">headers</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 91</tt>  <tt class="py-line">            <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Method s3.connection.S3Connection._path()=s3.connection.S3Connection-class.html#_path,Method s3.generator.S3Generator._path()=s3.generator.S3Generator-class.html#_path"><a title="s3.connection.S3Connection._path
s3.generator.S3Generator._path" class="py-name" href="#" onclick="return doclink('link-15', '_path', 'link-15');">_path</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">bucket</tt><tt class="py-op">,</tt> <tt class="py-name">obj</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 92</tt>  <tt class="py-line">            <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<tt class="py-lineno"> 93</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">headers</tt><tt class="py-op">,</tt> <tt class="py-name">dict</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Method s3.objects.S3Bucket.has_key()=s3.objects.S3Bucket-class.html#has_key,Method s3.service.S3Service.has_key()=s3.service.S3Service-class.html#has_key"><a title="s3.objects.S3Bucket.has_key
s3.service.S3Service.has_key" class="py-name" href="#" onclick="return doclink('link-16', 'has_key', 'link-16');">has_key</a></tt></tt><tt class="py-op">(</tt><tt class="py-string">"Content-Length"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 94</tt>  <tt class="py-line">                <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">headers</tt><tt class="py-op">[</tt><tt class="py-string">"Content-Length"</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 95</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">send_io</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 96</tt>  <tt class="py-line">                <tt class="py-name">length</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Method s3.connection.S3Connection._io_len()=s3.connection.S3Connection-class.html#_io_len,Method s3.generator.S3Generator._io_len()=s3.generator.S3Generator-class.html#_io_len"><a title="s3.connection.S3Connection._io_len
s3.generator.S3Generator._io_len" class="py-name" href="#" onclick="return doclink('link-17', '_io_len', 'link-17');">_io_len</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">send_io</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 97</tt>  <tt class="py-line">            <tt class="py-name">headers</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Method s3.connection.S3Connection._headers()=s3.connection.S3Connection-class.html#_headers,Method s3.generator.S3Generator._headers()=s3.generator.S3Generator-class.html#_headers"><a title="s3.connection.S3Connection._headers
s3.generator.S3Generator._headers" class="py-name" href="#" onclick="return doclink('link-18', '_headers', 'link-18');">_headers</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">method</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-name">length</tt><tt class="py-op">=</tt><tt class="py-name">length</tt><tt class="py-op">,</tt> <tt class="py-name">headers</tt><tt class="py-op">=</tt><tt class="py-name">headers</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 98</tt>  <tt class="py-line">             </tt>
<tt class="py-lineno"> 99</tt>  <tt class="py-line">            <tt class="py-keyword">def</tt> <tt class="py-def-name">do_c</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">100</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">putrequest</tt><tt class="py-op">(</tt><tt class="py-name">method</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Method s3.connection.S3Connection._params()=s3.connection.S3Connection-class.html#_params,Method s3.generator.S3Generator._params()=s3.generator.S3Generator-class.html#_params"><a title="s3.connection.S3Connection._params
s3.generator.S3Generator._params" class="py-name" href="#" onclick="return doclink('link-19', '_params', 'link-19');">_params</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">params</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">101</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">k</tt><tt class="py-op">,</tt><tt class="py-name">v</tt> <tt class="py-keyword">in</tt> <tt class="py-name">headers</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name" targets="Method s3.objects.S3Bucket.items()=s3.objects.S3Bucket-class.html#items,Method s3.service.S3Service.items()=s3.service.S3Service-class.html#items"><a title="s3.objects.S3Bucket.items
s3.service.S3Service.items" class="py-name" href="#" onclick="return doclink('link-20', 'items', 'link-20');">items</a></tt></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">102</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">putheader</tt><tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">,</tt> <tt class="py-name">v</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">103</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">endheaders</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno">104</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">105</tt>  <tt class="py-line">            <tt class="py-name">retry</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<tt class="py-lineno">106</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">107</tt>  <tt class="py-line">                <tt class="py-name">do_c</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">108</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">socket</tt><tt class="py-op">.</tt><tt class="py-name">error</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">109</tt>  <tt class="py-line">                 <tt class="py-comment"># if broken pipe (timed out/server closed connection)</tt> </tt>
<tt class="py-lineno">110</tt>  <tt class="py-line"><tt class="py-comment"></tt>                 <tt class="py-comment"># open new connection and try again</tt> </tt>
<tt class="py-lineno">111</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-keyword">if</tt> <tt class="py-name">e</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-number">32</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">112</tt>  <tt class="py-line">                    <tt class="py-name">retry</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
<tt class="py-lineno">113</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">retry</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">114</tt>  <tt class="py-line">                <tt class="py-name">do_c</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">115</tt>  <tt class="py-line">                 </tt>
<tt class="py-lineno">116</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">send_io</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">117</tt>  <tt class="py-line">                <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">send_io</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">MAXAMOUNT</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">118</tt>  <tt class="py-line">                <tt class="py-keyword">while</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">119</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">send</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">120</tt>  <tt class="py-line">                    <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">send_io</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">MAXAMOUNT</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">121</tt>  <tt class="py-line">                <tt class="py-name">send_io</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-comment"># seems to be needed to finish the response</tt> </tt>
<tt class="py-lineno">122</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">123</tt>  <tt class="py-line">                <tt class="py-name">r</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_conn</tt><tt class="py-op">.</tt><tt class="py-name">getresponse</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">124</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">httplib</tt><tt class="py-op">.</tt><tt class="py-name">ResponseNotReady</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">125</tt>  <tt class="py-line">                <tt class="py-name">e</tt><tt class="py-op">.</tt><tt class="py-name">args</tt> <tt class="py-op">+=</tt> <tt class="py-op">(</tt><tt class="py-string">'You are probably overlapping S3 ops, like doing f = bucket.get(k); bucket.keys(); f.read(). Try using bucket.clone() such as f = bucket.clone().get(k)'</tt><tt class="py-op">,</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">126</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt class="py-name">e</tt> </tt>
<tt class="py-lineno">127</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">r</tt><tt class="py-op">.</tt><tt class="py-name">status</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">200</tt> <tt class="py-keyword">or</tt> <tt class="py-name">r</tt><tt class="py-op">.</tt><tt class="py-name">status</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">299</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">128</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-21" class="py-name"><a title="s3.parsers.parseError" class="py-name" href="#" onclick="return doclink('link-21', 'parseError', 'link-3');">parseError</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">r</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">129</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">method</tt> <tt class="py-op">==</tt> <tt class="py-string">"GET"</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">130</tt>  <tt class="py-line">                <tt class="py-name">r</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">131</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">r</tt> </tt>
</div><tt class="py-lineno">132</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">f</tt> </tt>
</div></div><tt class="py-lineno">133</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="s3-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">Generated by Epydoc
        3.0alpha3 on Wed Sep 20 12:10:44 2006</td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
